﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Expect.Core.Interfaces;
using System.Globalization;

namespace Expect.Core.Test.Fixtures
{
    public class PriceTypeConverter : IExpectTypeConverter<Price>
    {
        object IExpectTypeConverter.Convert(string text)
        {
            var price = new Price();
            text = text.Trim();
            if (!string.IsNullOrEmpty(text))
            {
                var parts = text.Split(' ');
                price.Montant = Convert.ToDouble(parts[0], new CultureInfo("en-US"));
                price.Devise = parts[1];
            }
            return price;
        }
    }
}
